#ifndef PREVIEW_RENDERER_H_

#define PREVIEW_RENDERER_H_

//#include <media/stagefright/ColorConverter.h>
//#include <utils/RefBase.h>
//#include <system/window.h>
//#include <ui/GraphicBufferMapper.h>


namespace android {

class Surface;

class PreviewRenderer {
public:

static PreviewRenderer* CreatePreviewRenderer (
        JNIEnv *env, jobject surface,
        size_t width, size_t height);

    ~PreviewRenderer();

    void getBufferYV12(uint8_t **data, size_t *stride);

    void renderYV12();

    static size_t ALIGN(size_t x, size_t alignment) {
        return (x + alignment - 1) & ~(alignment - 1);
    }

private:
    PreviewRenderer(
            JNIEnv *env, jobject surface,
            size_t width, size_t height);

    int init();


    size_t mWidth, mHeight;

    

    PreviewRenderer(const PreviewRenderer &);
    PreviewRenderer &operator=(const PreviewRenderer &);
};

}  // namespace android

#endif  // PREVIEW_RENDERER_H_
